package cxm.proj.xtalk.smack;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.RosterGroup;

public class Group {
	String name = null;
	public Group(String groupName) {
		this.name = groupName;
	}
	
	public List<RosterEntry> getMembers() {
		List<RosterEntry> entrieslist = new ArrayList<RosterEntry>();
        RosterGroup rosterGroup = ConnectManager.getInstance().getConnector().
        		getConnection().getRoster().getGroup(this.name);
        Collection<RosterEntry> rosterEntry = rosterGroup.getEntries();
        Iterator<RosterEntry> i = rosterEntry.iterator();
        while (i.hasNext())
        	entrieslist.add(i.next());
        
        return entrieslist;
    }
}
